{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 9. Mixture Models and EM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from sklearn.datasets import fetch_openml\n",
    "%matplotlib inline\n",
    "\n",
    "from prml.clustering import KMeans\n",
    "from prml.rv import (\n",
    "    MultivariateGaussianMixture,\n",
    "    BernoulliMixture\n",
    ")\n",
    "\n",
    "np.random.seed(2222)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.1 K-means Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# training data\n",
    "x1 = np.random.normal(size=(100, 2))\n",
    "x1 += np.array([-5, -5])\n",
    "x2 = np.random.normal(size=(100, 2))\n",
    "x2 += np.array([5, -5])\n",
    "x3 = np.random.normal(size=(100, 2))\n",
    "x3 += np.array([0, 5])\n",
    "x_train = np.vstack((x1, x2, x3))\n",
    "\n",
    "x0, x1 = np.meshgrid(np.linspace(-10, 10, 100), np.linspace(-10, 10, 100))\n",
    "x = np.array([x0, x1]).reshape(2, -1).T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARMAAAD8CAYAAABUzEBbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAA+/UlEQVR4nO2dd5hU1fnHP+/U7bssvTdBAVFQFBVrLAFLrFFMzM+SaBI1xpLEGmti1xhji7HHFkERFLBgASsiWOi9LR2W7Tv9/f1xZ5eZnTuwZWYb5/M8++zce8+999zdme+c8j3vK6qKwWAwNBVHS1fAYDC0D4yYGAyGlG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XEKyL9gUFY6T/tyl0YfX0hkKylYzAYWjlNnRo+U0SKgMOBqSLyPoCqLgTeABYB7wFXqGo4es4zMdPI9wInishy4MTodn14uin1bsW01+eC9vts5rmiiGqThjIMBoMBMA5Yg8GQIoyYGAyGlNBmxKSp1v22gojcLiIbROT76M/JLV2npiAiY6P/lxUi0q4cziKyRkTmR/9PDZ5KbS2IyHMislVEFsTsa/BSlzYjJjTdut+W+Ieqjoj+TGvpyjSW6P/hcWAcMBQ4P/r/ak8cF/0/tWWvyQtYn51YGrzUpc2ISQqs+4bm51BghaquUtUA8DrW/8vQilDVWUBxnd0NXurSZsRkN/QE1sdsJ7PutyWuFJEfo83PtrySuj3+b2JR4AMRmRtd7tGeiFvqAiRd6lJDutbmNIrWYt1PN7t7TuBJ4C6sZ7gLeAi4pPlql1La3P+mgYxR1Y3RNWUfisiS6Lf8XkmrEpM0W/dbDfV9ThH5D/BumquTTtrc/6YhqOrG6O+tIjIJq1vXXsSkwUtd2kM3p77W/TZB9B9Xw5lYA89tlTnAIBHpLyIerIHyKS1cp5QgItkiklvzGjiJtv2/qkuDl7q0qpbJ7hCRM4F/AZ2xrPvfq+pPVXWhiNRY90PEWPfbKPeLyAis7sAa4LctWpsmoKohEbkSeB9wAs9Fl1q0B7oCk0QErM/Rq6r6XstWqXGIyGvAsUCn6PKY27CWtrwhIr8G1gE/3+N1jJ3eYDCkgvbQzTEYDK0AIyYGgyElGDExGAwpwYiJwWBICUZMDAZDSjBiYjAYUoIRE4PBkBL+H4/rAblne3BzAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "kmeans = KMeans(n_clusters=3)\n",
    "kmeans.fit(x_train)\n",
    "cluster = kmeans.predict(x_train)\n",
    "plt.scatter(x_train[:, 0], x_train[:, 1], c=cluster)\n",
    "plt.scatter(kmeans.centers[:, 0], kmeans.centers[:, 1], s=200, marker='X', lw=2, c=['purple', 'cyan', 'yellow'], edgecolor=\"white\")\n",
    "plt.contourf(x0, x1, kmeans.predict(x).reshape(100, 100), alpha=0.1)\n",
    "plt.xlim(-10, 10)\n",
    "plt.ylim(-10, 10)\n",
    "plt.gca().set_aspect('equal', adjustable='box')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## 9.2 Mixture of Gaussians"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARMAAAD8CAYAAABUzEBbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAx/UlEQVR4nO2dd3hUVfrHv++kzkwm9NCkiCIIKgoYRBdFV1kEC7oqWFjbytpW8SfuWh4VRF1ddtfeUOxtLYviiggq6KqIJBQBEQiIVLHQSU++vz/OTKbdSWYm9yaT8H7mOc/Mvafcc2+4X855z3vOEZJQFEWpL67GroCiKM0DFRNFUWxBxURRFFtQMVEUxRZUTBRFsQUVE0VRbMEWMRGRZ0XkJxFZHnKutYjMEZE1/u9WMfIOF5FVIlIkIjfbUR9FURoeu1omzwMYHnHuZgAfk+wJ4GP/cRgikgbgMQCnAugD4HwR6WNTnRRFaUBsEROSnwHYHnH6TAAv+H+/AGCURdZ8AEUk15EsB/C6P5+iKE2MdAfLbk9yKwCQ3CoieRZpOgPYGHK8CcAgq8JEZByAcQDg9XoH9O7d2+bqKooSoLCw8BeS7RLJ46SYxINYnLP07yc5FcBUABg4cCALCgqcrJei7NeIyA+J5nFyNGebiHQEAP/3TxZpNgHoEnJ8AIAtDtZJURSHcFJMZgC42P/7YgDvWqRZCKCniBwoIpkAxvjzKYrSxLBraPg1APMB9BKRTSJ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SskhIq8BGAqgrX96zJ0wU1veEJHLAWwAcG6d5ag7vaIodtAcujmKoqQAKiaKotiCiomiKLagYqIoii2omCiKYgsqJoqi2IKKiaIotvD/Cl8EPY2eEpQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "gmm = MultivariateGaussianMixture(n_components=3)\n",
    "gmm.fit(x_train)\n",
    "p = gmm.classify_proba(x_train)\n",
    "\n",
    "plt.scatter(x_train[:, 0], x_train[:, 1], c=p)\n",
    "plt.scatter(gmm.mu[:, 0], gmm.mu[:, 1], s=200, marker='X', lw=2, c=['red', 'green', 'blue'], edgecolor=\"white\")\n",
    "plt.xlim(-10, 10)\n",
    "plt.ylim(-10, 10)\n",
    "plt.gca().set_aspect(\"equal\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### 9.3.3 Mixtures of Bernoulli distributions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/9s/lky4p_js2czgsr4_5962ffbw0000gn/T/ipykernel_10929/1003235212.py:6: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.\n",
      "Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations\n",
      "  x_train = (x_train > 127).astype(np.float)\n"
     ]
    }
   ],
   "source": [
    "x, y = fetch_openml(\"mnist_784\", return_X_y=True, as_frame=False)\n",
    "x_train = []\n",
    "for i in [0, 1, 2, 3, 4]:\n",
    "    x_train.append(x[np.random.choice(np.where(y == str(i))[0], 200)])\n",
    "x_train = np.concatenate(x_train, axis=0)\n",
    "x_train = (x_train > 127).astype(np.float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABGoAAADOCAYAAABmdeTtAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAekUlEQVR4nO3de29U1/0u8E0INxuMMeYO5u4UEgKlVaOoL6Bvt6+gqqKqqhRVbSCQAOUOxhjbGAzmYlLOHz8dHemc+T4cNthZwOfz5zzaw56ZvfZasxj5WfP69esOAAAAgF/fZ7/2CQAAAADwP2zUAAAAADTCRg0AAABAI2zUAAAAADTCRg0AAABAIz5P4Zo1a1RC8Ul7/fr1ml/7HAYxNvnUGZvQJmMT2mRsQpuqsekXNQAAAACNsFEDAAAA0AgbNQAAAACNsFEDAAAA0AgbNQAAAACNsFEDAAAA0IhYzw3A+7NmTd2M+fq1dkoAAMAvagAAAACaYaMGAAAAoBE2agAAAAAaYaMGAAAAoBE2agAAAAAaYaMGAAAAoBHqud9SqtdNVO8CiepuAPh0+E5BJV0ba9euLbPPPqt/g/Hf//73nc7p/5auw19++aXM+l73fc/lQ+YXNQAAAACNsFEDAAAA0AgbNQAAAACNsFEDAAAA0AgbNQAAAACNsFEDAAAA0IiPup471X+tX7++zDZu3Fhmqf4rZZ9/Xr/Vz58/H/h4qjZLWapmW15eLjP1wHyK0njpc0yqPzSO+BSl+bavapz1rR9937WlXdfv3tJ1K3Mu8LZWszr6Q6nrVafN20rXTJoj0vfGDRs2lFmq7q7m4i1btrz1MV2Xz7/6btt1Xbe4uFhmz549K7MXL16UWRpjL1++LLPW+UUNAAAAQCNs1AAAAAA0wkYNAAAAQCNs1AAAAAA0wkYNAAAAQCNs1AAAAAA04oOo505VY6mOa+vWrWW2bdu2MhsaGiqzHTt2lNnu3bvLbHR0tMyq1/fkyZPymC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AAAABphowYAAACgETZqAAAAABphowYAAACgETZqAAAAABrRVGdjVWWYKr371u6muspUz51qzyYnJ3tlVc1a32rBVDX29OnTMks1jWvXri2zvtJ5qvzmfUr1gik7fPjwwMcPHjxYHvPgwYMyS7WDqYp4cXGxzGCQVJu5a9euMktz1fbt28ss1fXevn27zC5cuFBmFy9eLLOqhjvNcX3nlfXr1/d6zvS67969W2YnTpzodS5VltY05uF3k+aPap2ZPsNUzz08PFxmaUyn9Vsat2mdnOay6jmrauCu63+/SjXFGzZsKLMrV66U2fLycpk9evSozNJ4qa6TVN2c6qDT9yJWRhrrSRpHfeut070gVd3fv39/4ONpjkj3j7GxsTJL32HTvJOqtKempnodl6T7Ugv8ogYAAACgETZqAAAAABphowYAAACgETZqAAAAABphowYAAACgETZqAAAAABqx6vXcq1kpl+q/Uj1iqhs7efJkmR05cqTMdu/e/dZZqmZLWaoIHB0dLbNUwZbq5VJl+dLSUpm1XonGxyNd26nm8PTp0wMfTxWq9+7dK7NU15vquaFSzXM7duwojzl69GiZ7d+/v8zS3JJqa8+fP19mly9fLrPp6ekye/78eZlV+lZRp38r1eum6uNUAby4uNjr36vqiFNNcXpPeLO0pq2yNB+lz/fAgQNltmfPnjJL691Ud5vWfanOt1rTpuuwmmu7ruuOHTtWZocPHy6zubm5Mktr4fR+pdf94sWLMqs+81T5nO5Jfa473k0am6kSO43NM2fOlNnk5GSZpXk6XYfVnPTgwYPymHTNp+9/6f16+vRpmaX5Np1nGi99sxaYoQEAAAAaYaMGAAAAoBE2agAAAAAaYaMGAAAAoBE2agAAAAAaseqtT6sp/eXz9Fesx8fHyyy1vTx+/LjMFhYW3vrfS38VO/017fS601+3Tq1V6a9wp2aL+fn5MkutT9VfwvfX7OkjtTik8V41SqTrMI2HCxculFmfFhuomllSC0W616fjkp9++qnMrl69Wmap7ezVq1dvfR6pqSbp2wqR2ps2b95cZps2bSqz9BrSvadqi0rrFq1PK6dap6XPd2RkpMxSe+jevXvLLLWEpmsjrdEmJibKrB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b9+fZlV12Hf9or0F/KTdP6fKmPzf6S2lz7HrESW5uI0h6dsw4YNZVZJLTCp6WUlxvTHzNhcGSsxVtLaNM3FKRsdHR34eFrXpTVBGmNp3ZoaGFMjUHrOtKZN51kdt9rNMp/S2OzTkpbGUZrj0joyrVv7Nrmlay1d29VaMl3XK9Hgyv+rGpt+UQMAAADQCBs1AAAAAI2wUQMAAADQCBs1AAAAAI2wUQMAAADQCBs1AAAAAI1YkXruVvStFEu1g+k5+9ZbV8e94bMps776PmcrVdor4VOqMvzQ9R2bfa77dMzHPB5aYmxCm4zNLM0fK1GFm55zaGiozNauXdvrOassrYNTLfKLFy/KbHl5+a3Po+vyPJ2qij/0ymFjE9qknhsAAACgcTZqAAAAABphowYAAACgETZqAAAAABphowYAAACgETZqAAAAABrxUddzw7tSZQhtMjahTcZmf33ruT8EH3q19cfA2IQ2qecGAAAAaJyNGgAAAIBG2KgBAAAAaISNGgAAAIBG2KgBAAAAaISNGgAAAIBGfP5rnwAAAHzqVFgD8L/5RQ0AAABAI2zUAAAAADTCRg0AAABAI2zUAAAAADTCRg0AAABAI2zUAAAAADRijSpAAAAAgDb4RQ0AAABAI2zUAAAAADTCRg0AAABAI2zUAAAAADTCRg0AAABAI2zUAAAAADTifwHH19WzmkBLvQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 1440x360 with 5 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "bmm = BernoulliMixture(n_components=5)\n",
    "bmm.fit(x_train)\n",
    "\n",
    "plt.figure(figsize=(20, 5))\n",
    "for i, mean in enumerate(bmm.mu):\n",
    "    plt.subplot(1, 5, i + 1)\n",
    "    plt.imshow(mean.reshape(28, 28), cmap=\"gray\")\n",
    "    plt.axis('off')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
